Differences Between BASIC I and BASIC II

INTRODUCTION
============

During 1982, an enhanced version of BBC Basic was created by Acorn in
response to requests from users for additional facilities.  In
particular it was felt that the 6502 Assembler, which is a component
part of BBC Basic, could be improved by the addition of an ability to
generate code for sideways ROM's and other memory areas not usually
mapped to RAM.  Some of the BASIC keywords have been extended so they
are more powerful and some additional ones have been incorporated.
Furthermore some of the arithmetic routines have been recoded for
greater precision.  In keeping with Acorn's policy of providing a series
of enhancements to our software, the BASIC ROM can be reordered from any
Acorn dealer.

Issue II BASIC
==============

The new version of BASIC's differences with the old version are as
follows:-

1. ELSE no longer leaves a byte on the hardware stack in ON..GOTO/GOSUB.

2. INSTR no longer leaves the shorter string of INSTR("AB","ABC") on the
software stack.

3. The lexical analyser is called correctly from EVAL so that
EVAL("TIME") works.

4. ABS can take the absolute value of integers without bit 31 set
without returning a string (i.e. PRINT -ABS 1 works).

5. ASC":" can be used in the assembler without confusing it.

6. A new statement OSCLI has been introduced, shortest abbreviation OS.,
token value &FF.  It takes a string expression and gives it to the
operating system, e.g. OSCLI"KEY"+STR$Z+". This is key "+STR$Z.  It has
no unique errors of its own, just the normal "Type mismatch" error.

7. The value of the token for OPENIN has changed to &8E and now just
opens files for input only using the &40 open.  A new keyword OPENUP
(open for update) has been introduced with the old token &AD which opens
files for update using the &C) open.  This results in old programs
automatically changing to OPENUP when they are LOADed into the new
interpreter.

8. The next bit of OPT (OPTs 4 to 7) controls whether code generated by
the assembler will be put at the program counter P% or at the code
original O%.  If it is set code will be put at O% and both O% and P%
incremented, if unset only P% will be used.  Current implementation
results in all OPTs greater than 3 causing code to be put at O%.

9. The LN and LOG functions are completely recoded to make them more
accurate and to avoid the LN(2E-39) bug.

10. The fix routine avoids the INT1E38 bug.

11. The SIN/COS functions are completely recoded to make them more
accurate.

12. The binary to decimal string conversion routines, used for PRINT and
STR$, have been changed to allow for the use of 10 figures of precision
on printing.  The initial value of @% is now &0000090A to give the same
results on startup.  Note that @%=10 now gives the internal default of
10 figures.  The changes allow the maximum positive integer 2147483647
to be printed out (and indeed get 2^32 right).  STR$ when not controlled
by @% uses the new 10 figure default which will result in it giving
different answers to before e.g. 7.7 (a recurring binary fraction) will
be converted to 7.699999999.

13. Four new operations are available in the assembler.  These are EQUB,
EQUW, EQUD, EQUS.  They have no errors of their own apart from the Type
mismatch error.  They take a single argument and put its value into the
assembly code.  EQUS puts all the characters of a string into the code
WITHOUT a carrige return like $P%; if you need a carrige return just add
it to the string.  EQUS may be used together with FN to implement macros
as shown in this example:-

DEF FNOSBYTE(A,X,Y)
IF A>127 [OPT Z:LDY#Y:]
[OPT Z:LDX#X:LDA#A:JSR&FFF4:]
=""

[OPT Z
EQUS FNOSBYTE(&99,33,44)
EQUS FNOSBYTE(2,1,0)
]

14. The startup REPORT is the way to tell the new version of BASIC from
the old one, the new one has (c)1982.

15. The bug associated with ON ERROR GOTO 9999 has been removed.

16. A MODE change now resets COUNT.

17. BASIC will now only execute if A contains 1 on entry at 8000.  There
is no entry at 8003 any more.

18. BASIC is of type 60; this means that it contains its own tube
relocation address after all the standard sideways ROM items.  Of
course, with the general release this will be 00008000 (the default for
no relocation) but this gives more trouble free production of relocated
versions to run at 0000B000.

19. The version number is 01.

20. In INPUT ';' is introduced and functions as the ',' does.

21. Fatal errors have been introduced.  Errors whose ERR is zero cause
an ON ERROR OFF effect while they are being processed.

22. STOP has been redefined as a fatal error, this causes the STOP at
line 0 message to be corrected to STOP.

23. The "No room" error is a fatal error.

24. The standard error handling procedures do not use stack space any
more.  The situation of running out of all free space no longer causes
error messages to be printed out followed by a "No room" message.

25.  The allocation of space for strings has been made slightly more
efficient, it can cope with REPEAT A$=A$+"*": UNTIL LEN A$=255 and only
allocate 255 bytes.  It still has problems if B$ is being done
alternatively with A%.

26. A new error 45 "Missing #" arrives if PTR, EOF, BGET, BPUT, EXT have
a missing #.

27. DIM P% -2 gives Bad DIM.


Differences Between BASIC II and BASIC 4
DIFFERENCES BETWEEN BASIC 2 AND BASIC 4
=======================================

-BASIC IV-
Incorporates changes from BASIC II to BASIC III as follows:
* Provides some formatting of Assembly listings
* COLOR is accepted as an alternative to COLOUR
* SAVE A$+B$ works correctly
* Use of ! & ? as formal parameters works correctly
* A USA version listing COLOR instead of COLOUR is available

Includes the following additional changes:
* The version number in ROM is 4.
* Incorportates all the 65C02 (65C12) instructions in Assembler:
        * DEC A may be represented as DEA
        * INC A may be represented as INA for compatibility with MASM
        * STZ may be represented as CLR
* ASL ALFRED or similar is accepted i.e. the 'A' indication of
accumulator addressing mode for ASL LSR ROL ROR DEC INC no longer
affects symbol recognition.
* X, Y or A in the Assembler may be in lower case. EQUB, EQUW, EQUD and
EQUS may alos be in lower case.
* Trailing spaces will always be stripped from lines entered into the
interpreter.
* Leading spaces will be stripped from lines entered into the
interpreter when a non-zero LISTO is set.  The assumption is that there
will be a formatted listing on screen when cursor editing is used when
LIST is non-zero.
* LISTO indents loops correctly.
* Corss-reference/Search output is available from LIST.  Lines will be
LISTed IF the specified string is present e.g.:
        LIST IF DEF
        LIST 10,1000 IF =
        LIST ,2000 IF A%
It is not possible to search for TIME=90, for example, as a statement.
It will only be checked for as a boolean expression.  PTR, HIMEM, PAGE,
LOWMEM are similarly affected.
* RENUMBER or LSIT will not be affected by &8D in comments or strings.
In addition, LIST will no be confused by coloured comments.
* A statement to update an open file's extent 'EXT#chan=length' has been
added.  This uses OSARGS and so will not work until there are suitable
filing systems.
* A display real-time clock pseudo variable TIME$ has been introduced.
It fetches a fixed 24 byte string from the OS in response to PRINT TIME$
(or similar).  The string looks like Wed,31 Dec 1900.23:59:59. Assiging
to TIME$="fred" merely passes the string directly to the OS with the
length in the first byte.
* AUTO no longer outputs a space after the line number.
* General recursion is now allowed in 'FOR' loops e.g.:
        DEF FNQ FORJ=1TO10:P.J;:N.:=10
        FOR I=FNQ-9 TO FNQ STEP FNQ/10
now works.  In previous versions only the first FNQ or FNQ's without the
for loop would work.
* A new command EDIT which has identical syntax to LIST (even the IF
section) can be used to create an in core text file of the current
program (or section of it e.g. EDIT 10,100).  It then issues the command
"*EDIT hh,hh" where the hex addresses are addresses in zero page of the
start of the in-memory text and the address in zero page of the end of
the in-memory text plus one.  LISTO 0 is set before conversion begins.
If there is not enough space to convert the entire file, the error
message "No room" will be given togehter with a line number which shows
how far through the progrma it had got: at this stage either CLEAR of a
different EDIT command should be used.  ESCAPE will behave similarly,
stopping the conversion to text.
* Use of the "|" character at the end of VDU parameters can be used to
insert the correct number of remaining zeros.

A full description of BBC BASIC IV can be found in the Master Series
Reference Manual Part 2 (Product Ordering Code ADJ23).  The Master
Series Welcome Guide contains a summary of the features (Product
Ordering Code ADJ01).

